package com.design_pattern._01_create._01_singleton;

/**
 * 懒汉模式-双重检查
 */
public class V2 {
    private static V2 instance;

    private V2() {
        super();
    }

    public static V2 getInstance() {
        if (instance == null) {
            synchronized (V2.class) {
                if (instance == null) {
                    instance = new V2();
                }
            }
        }
        return instance;
    }
}
